package com.coolingme.login;

/**
 * 环境角色
 *
 * @author wangyue
 * @date 2020-09-26 0:23
 */
public class AppContext {

    public static final UserState LOGIN_STATE    = new LoginState();
    public static final UserState UN_LOGIN_STATE = new UnLoginState();

    /**
     * 默认状态
     */
    private UserState currentState = UN_LOGIN_STATE;

    public void setCurrentState(UserState currentState) {
        this.currentState = currentState;
    }

    {
        LOGIN_STATE.setContext(this);
        UN_LOGIN_STATE.setContext(this);
    }


    public void read() {
        this.currentState.read();
    }

    public void comment(String content) {
        this.currentState.comment(content);
    }


}
